<html>

	<head>

	

	</head>
	<body>

<?php




	echo "

		<html>

			<body>
				<div id='titulo'>Transferencias</div>
				<div id='titulo3'><a href='administracion.php?objsel=crearnuevatransferencia'><img src=\"../images/iconos/add.gif\"/>Anadir nuevo</a></div>

	
	";

	
	$conexion = mysql_connect($servidor,$usuario,$clave);
	mysql_select_db($bd,$conexion);

	$peticion = mysql_query("SELECT * FROM compras WHERE almacen='provisional'");

	$numero = mysql_num_rows($peticion);
	
	if ($numero >= 1) {
	echo "

		<table class='tabla1' width=940>
		<tr>
		<th>Id</th>
		<th>Id Objeto</th>
		<th>Unidades</th>
		<th>Proveedor</th>
		<th>Precio</th>
		<th>Almacen</th>
		<th>Destino</th>
		<th></th>
		<th></th>
		</tr>
	";

	while ($fila = mysql_fetch_array($peticion)){

		echo "
		<form action='transferir.php?id=".$fila['id']."' method='POST'>
			<tr>

				<td>".$fila['id']."</td>
				<td>".$fila['idarticulo']."</td>
				<td>".$fila['unidades']."</td>
				<td>".$fila['lugarcompra']."</td>
				<td>".$fila['precio']."</td>
				<td>".$fila['almacen']."</td>
				<td><select id='almacendestino' name='almacendestino'>
		";
		
				
						$conexion1 = mysql_connect($servidor,$usuario,$clave);
						mysql_select_db($bd,$conexion1);

						$peticion1 = mysql_query("SELECT * FROM almacenes");
						
						while ($file = mysql_fetch_array($peticion1)){
						
							echo "
							
								<option value=".$file['lugar'].">".$file['lugar']."</option>
							
							";
							}	
			
		echo "		
				
				
				</select>
				</td>
				
				
				<td><input type='image' src=\"../images/iconos/transfer.png\"/></td>
				</form>
				
				</tr>

				


		";
	}

	echo " </table> 

	";
	
	} else {
	
		echo "
		
		<div id='titulo4'>No Hay nada que transferir</div>
		
		";
	
	}



?>

</body>

</html>